<?php
	/**
	 * Created by PhpStorm.
	 * User: mybook-lhp
	 * Date: 18/7/10
	 * Time: 上午11:21
	 */

	namespace app\payment\admin;


	use app\admin\controller\Admin;
	use app\common\builder\ZBuilder;
	use app\payment\model\PaymentOrderModel;

	/**
	 * 支付订单管理
	 * Class Order
	 * @package app\payment\admin
	 */
	class Order extends Admin
	{
		public function index()
		{
			// 查询
			$map = $this->getMap();
			// 排序
			$order = $this->getOrder();
			// 数据列表
			$data_list = PaymentOrderModel::where($map)->order('id desc')->paginate();

			$btnType = [
				'class' => 'btn btn-info',
				'title' => '重新回调',
				'icon'  => 'fa fa-fw fa-sitemap',
				'href'  => url('recallback', ['id' => "__id__"])
			];


			// 使用ZBuilder快速创建数据表格
			return ZBuilder::make('table')
				->setSearch(['pay_type' => '支付类型'])// 设置搜索框
				->addColumns([ // 批量添加数据列
							   ['id', 'ID'],
							   ['member_id', '用户ID', 'text'],
							   ['order_sn', '交易订单号', 'text'],
							   ['pay_sn', '支付订单号', 'text'],
							   ['user_money', '交易金额', 'text'],
							   ['order_type', '订单类型', 'text'],
							   ['status', '订单状态	', 'text'],
							   ['right_button', '操作', 'btn']
				])
				->addRightButtons(['recallback' => $btnType])// 批量添加右侧按钮
				->addOrder('id desc')
				->setRowList($data_list)// 设置表格数据
				->fetch(); // 渲染模板
		}
	}